//
//  baoxiuleixinggViewController.m
//  wuyeviewcon
//
//  Created by dsdf on 16/1/27.
//  Copyright © 2016年 joey. All rights reserved.
//

#import "baoxiuleixinggViewController.h"
#import "DetailsTableViewCell.h"

@interface baoxiuleixinggViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    
    UITableView * personalTableView;
    NSArray *arry;
}


@end

@implementation baoxiuleixinggViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.navigationController.navigationBar.barTintColor = [[UIColor alloc] initWithRed:230/255.0 green:55/255.0 blue:55/255.0 alpha:1.0];
    
    
    self.title = @"详情";
    [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont systemFontOfSize:19],
       NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 20, 20);
    [button setBackgroundImage:[UIImage imageNamed:@"return@2x.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(fanhui) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * leftItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    
    arry=[NSArray arrayWithObjects:@"门",@"窗",@"五金",@"给水",@"供电",@"供暖",@"房屋本地",@"洁具",@"家具",@"其他报修", nil];
    
    personalTableView=[[UITableView alloc]initWithFrame:CGRectMake(0,64,375,500) style:UITableViewStyleGrouped];
    [self.view addSubview:personalTableView];
    personalTableView.delegate=self;
    personalTableView.dataSource=self;
    personalTableView.bounces=NO;
    personalTableView.showsVerticalScrollIndicator = NO;//不显示右侧滑块
    personalTableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;//分割线
    arry=@[@"公共设施",@"治安维护",@"服务态度",@"邻里纠纷",@"清洁环境",@"地产" ,@"业务流程",@"其他"];
    
    //_tableview.dataSource=self;
    //_tableview.delegate=self;
    
    //公共设施  治安维护  服务态度  邻里纠纷  清洁环境  地产  业务流程  其他
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)fanhui {
    
    [self.navigationController popViewControllerAnimated:YES];
    //[self dismissModalViewControllerAnimated:YES];
}


//
//- (NSInteger)tableview:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//    return 10;
//}
//
//- (UITableViewCell *)tableview:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//    static NSString * str = @"cell3";
//    DetailsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:str];
//    if (!cell) {
//        cell = [[[NSBundle mainBundle]loadNibNamed:@"DetailsTableViewCell" owner:nil options:nil]objectAtIndex:2];
//    }
//    cell.textLabel.text=[arry objectAtIndex:indexPath.row];
//    //cell.lablecelldemo.text=[arry objectAtIndex:indexPath.row];
//    cell.baoxiuleixingtxt.text=[arry objectAtIndex:indexPath.row];
//    return cell;
//}
//
//- (void)tableview:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    
//    DetailsTableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
//    //cell.selectImage.image = [UIImage imageNamed:@"勾选状态.png"];
//    cell.baoxiuleixingimage.image=[UIImage imageNamed:@"勾选状态.png"];
//}



//-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//{
//    //分组数 也就是section数
//    return 3;
//}

//设置每个分组下tableview的行数
//-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//{
//    if (section==0) {
//        return  arry.count;
//    }
////    else if (section==1) {
////        return arry.count;
////    }
//    
//    else{
//        return 1;
//    }
//}
//每个分组上边预留的空白高度
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//    
//    return 20;
//}
//每个分组下边预留的空白高度
//-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
//{
//    if (section==2) {
//        return 40;
//    }
//    return 20;
//}
//每一个分组下对应的tableview 高度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        return 80;
    }
    return 40;
}

//设置每行对应的cell（展示的内容）
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *str=@"cell4";
    DetailsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:str];
    //DetailsTableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:str];
    if (!cell) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"DetailsTableViewCell" owner:nil options:nil]objectAtIndex:3];
    
    //cell.textLabel.text=[arry objectAtIndex:indexPath.row];
    cell.baoxiuleixingtxt.text=[arry objectAtIndex:indexPath.row];
        }
    return cell;
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    DetailsTableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.selectImage.image = [UIImage imageNamed:@"勾选状态.png"];

    
}




/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
